﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Region.Forms
{
    public partial class ProcurorForm : Form
    {
        Engine m_engine;
        Procuror m_procuror;
        ObjectFormUtil m_reader;

        void read()
        {
            m_reader.get();
            
        }
        public void save()
        {
            m_reader.set();
            m_procuror.save();
        }
        public ProcurorForm(Engine Engine,Int32 ProcurorID)
        {
            m_engine = Engine;            
            m_procuror = Engine.getProcuror(ProcurorID);
            m_reader = new ObjectFormUtil(m_engine,m_procuror);
            InitializeComponent();
            m_reader.AddEditor(ProcurorNum, "ProcurorNum");
            m_reader.AddEditor(Start, "Start");
            m_reader.AddEditor(End, "End");
            m_reader.AddEditor(NumNar, "NumNar");
            m_reader.AddEditor(Comment, "Comment");            
            m_reader.AddEditor(IspUserID, "IspUserID",m_engine.UserFIO);            
            m_reader.AddEditor(OtdelID, "OtdelID", m_engine.OtdelsForTree);            
            read();
        }
        private void ProcurorForm_Load(object sender, EventArgs e)
        {

        }

        private void Save_Click(object sender, EventArgs e)
        {
            save();
        }
        private void ZoomPlus_Click(object sender, EventArgs e)
        {
            Font = new Font(Font.FontFamily, (float)Math.Min(Font.Size * 1.2, 17.1));
            Properties.Settings ps = Properties.Settings.Default;
            //ps.ProcurorForm_Size = Font.Size;
            //ps.Save();
        }

        private void ZoomMinus_Click(object sender, EventArgs e)
        {
            Font = new Font(Font.FontFamily, (float)Math.Max(Font.Size / 1.2, 6.875));
            Properties.Settings ps = Properties.Settings.Default;
            //ps.ProcurorForm_Size = Font.Size;
            //ps.Save();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
